import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:imember/Util/Global.dart';
import 'package:imember/Util/MyColor.dart';
import 'package:imember/Widget/MyButton.dart';
import 'package:imember/Widget/MyInput.dart';
import 'package:imember/Widget/MyPage.dart';

class StockAdjust extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return StockAdjustState();
  }
}

class StockAdjustState extends State<StockAdjust> {
  @override
  Widget build(BuildContext context) {
    return MyPage(
        Container(
          child: Column(
            children: [
              Container(height: 19),
              Row(children: [
                Container(width: 12),
                Container(width: 155, alignment: Alignment.center, child: Text("商品名稱", style: TextStyle(color: MyColor.C70, fontSize: 20))),
                Container(
                    width: 155, alignment: Alignment.center, child: Text("與實際盤點不符", style: TextStyle(color: MyColor.C70, fontSize: 20))),
                Expanded(
                  child: Center(child: Text("短溢原因", style: TextStyle(color: MyColor.C70, fontSize: 20))),
                )
              ]),
              Container(height: 15),
              Container(height: 2, color: MyColor.DD),
              Expanded(
                  child: ListView.builder(
                      itemCount: 24,
                      itemBuilder: (BuildContext context, int index) {
                        return ItemInput();
                      })),
              Container(height: 24),
              Row(mainAxisAlignment: MainAxisAlignment.end, children: [
                IconBtn("儲存並列印", "ic_printer.png", width: 170),
                Container(width: 13),
                IconBtn("儲存", "ic_check.png", width: 120, bgColor: MyColor.Orange),
                Container(width: 54),
              ]),
              Container(height: 40),
            ],
          ),
        ),
        title: "盤點調整");
  }
}

class ItemInput extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
        padding: EdgeInsets.fromLTRB(12, 0, 40, 0),
        margin: EdgeInsets.fromLTRB(0, 8, 0, 8),
        child: Row(
          children: [
            Container(width: 155, alignment: Alignment.center, child: Text("義大利麵", style: TextStyle(color: MyColor.C66, fontSize: 20))),
            Container(
              width: 155,
              height: 36,
              alignment: Alignment.centerLeft,
              margin: EdgeInsets.fromLTRB(4, 0, 4, 0),
              padding: EdgeInsets.fromLTRB(18, 0, 18, 0),
              decoration: Global.getBoxBg(18, MyColor.FFD4),
              child: Text("-2",style: TextStyle(color: MyColor.Red62, fontSize: 20))
              // NormalInput(fontColor: MyColor.Red62, fontSize: 20, keyboardType: TextInputType.number, customReg: "[0-9-]"),
            ),
            Expanded(
                child: Container(
                    height: 36,
                    margin: EdgeInsets.only(left: 24),
                    decoration: Global.getBoxBg(23, MyColor.F2),
                    padding: EdgeInsets.fromLTRB(27, 0, 27, 0),
                    child: NormalInput(fontSize: 20)))
          ],
        ));
  }
}
